import 'package:flutter/material.dart';
import 'package:xvideos/hj_utils/api_service/ai_service.dart';
import 'package:xvideos/tools_base/base_list_controller.dart';

class AIChangeFaceLogic extends ListBaseLogic {
  int type = 0; //0-视频换脸 1-图片换脸

  late TabController tabCtr;

  AIChangeFaceLogic({this.type = 0});

  @override
  void onReady() {
    super.onReady();
    loadData();
  }

  loadData() async {
    dataList ??= [];
    final resp = await AIService.getAIChangeFaceList(type: type);
    if (resp != null) {
      dataList?.addAll(resp.categoryList ?? []);
      tabCtr = TabController(length: dataList?.length ?? 0, vsync: this);
    }
    update();
  }
}
